/**
 * 
 */
package com.bagtrack.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonIgnore;


/**
 * @author Brian Boyle
 * Nov 13, 2011
 *
 */
@Entity
@Table(name = "FLIGHT")
public class Flight {

    public static final String COMPLETE_STATUS = "COMPLETE";
    public static final String IN_COMPLETE_STATUS = "IN_COMPLETE";
    public static final String UNLOADING = "UNLOADING";

    private Long id;
    private String flightNumber;
    private String origin;
    private Date arrivalTime;
    private String status;
    private Carousel carousel;
    private AircraftType aircraftType;
    private Gate gate;
    private Job job;


    /**
     * @param flightNumber
     * @param origin
     * @param arrivalTime
     */
    public Flight(String flightNumber, String origin, Date arrivalTime, String status) {
        this.flightNumber = flightNumber;
        this.origin = origin;
        this.arrivalTime = arrivalTime;
        this.status = status;
    }

    /**
     * Default Constructor
     */
    public Flight() {
    }


    /**
     * @return the id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "ID")
    public Long getId() {
        return id;
    }


    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }


    /**
     * @return the flightNumber
     */
    @Column(name = "FLIGHT_NUM")
    public String getFlightNumber() {
        return flightNumber;
    }


    /**
     * @param flightNumber the flightNumber to set
     */
    public void setFlightNumber(String flightNumber) {
        this.flightNumber = flightNumber;
    }


    /**
     * @return the origin
     */
    @Column(name = "ORIGIN")
    public String getOrigin() {
        return origin;
    }


    /**
     * @param origin the origin to set
     */
    public void setOrigin(String origin) {
        this.origin = origin;
    }


    /**
     * @return the arrivalTime
     */
    @Column(name = "ARRIVAL_TIME")
    public Date getArrivalTime() {
        return arrivalTime;
    }


    /**
     * @param arrivalTime the arrivalTime to set
     */
    public void setArrivalTime(Date arrivalTime) {
        this.arrivalTime = arrivalTime;
    }


    /**
     * @return the status
     */
    @Column(name = "STATUS")
    public String getStatus() {
        return status;
    }


    /**
     * @param status the status to set
     */
    public void setStatus(String status) {
        this.status = status;
    }

    /**
     * @return the carouselId
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "CAROUSEL_ID")
    @JsonIgnore
    public Carousel getCarousel() {
        return carousel;
    }


    /**
     * @param carouselId the carouselId to set
     */
    public void setCarousel(Carousel carousel) {
        this.carousel = carousel;
    }


    /**
     * @return the aircraftType
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "AIRCRAFT_TYPE_ID")
    @JsonIgnore
    public AircraftType getAircraftType() {
        return aircraftType;
    }


    /**
     * @param aircraftType the aircraftType to set
     */
    public void setAircraftType(AircraftType aircraftType) {
        this.aircraftType = aircraftType;
    }


    /**
     * @return the gate
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "GATE_ID")
    @JsonIgnore
    public Gate getGate() {
        return gate;
    }


    /**
     * @param gate the gate to set
     */
    public void setGate(Gate gate) {
        this.gate = gate;
    }


    /* (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return "Flight [id=" + id + ", flightNumber=" + flightNumber + ", origin=" + origin + ", arrivalTime=" + arrivalTime + ", carouselId=" + carousel + "]";
    }

}
